package cn.iocoder.yudao.module.trade.enums.giftcard;

import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.Arrays;

/**
 * 礼品卡状态
 */
@RequiredArgsConstructor
@Getter
public enum GiftCardStatusEnum implements IntArrayValuable {



    CAN_USE(0, "可使用"),
    IN_RECEIVE(1, "赠送中"),
    IS_RECEIVE(2, "已赠送"),
    NO_USE(3, "不可用"),
    REFUND(4, "退款"),;

    public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(GiftCardStatusEnum::getType).toArray();

    /**
     * 类型
     */
    private final Integer type;
    /**
     * 类型名
     */
    private final String name;

    @Override
    public int[] array() {
        return ARRAYS;
    }

    public static boolean isCanUse(Integer type) {
        return ObjectUtil.equal(type, CAN_USE.getType());
    }

    public static boolean isInReceive(Integer type) {
        return ObjectUtil.equal(type, IN_RECEIVE.getType());
    }

    public static boolean isReceive(Integer type) {
        return ObjectUtil.equal(type, IS_RECEIVE.getType());
    }

    public static boolean isNoUse(Integer type) {
        return ObjectUtil.equal(type, NO_USE.getType());
    }

}
